<?php
/* @var $this UserController */

$this->breadcrumbs=array(
	'Admin',
	'Users'
);
?>
<h3 align="center">Users</h3>
<?php
    $this->widget('zii.widgets.grid.CGridView', array(
		'enableSorting'=>false,
        'dataProvider'=>$dataProvider,
        'columns'=>array(
            array(
				'header' => 'Index',
				'value'=> '++$row'
			),
			'username',
			'displayname',
			'position',
			'email',
			'mobile',
			array(
				'name'=>'isadmin',
				'value'=>'$data->isadmin?"True":"False"'
			),
			array(
				'name'=>'active',
				'value'=>'$data->active?"True":"False"'
			),
            array(
                'class'=>'CButtonColumn',
                'template'=>'{update}{delete}',
				'deleteConfirmation'=>'js:"Do you want to deactive this user?"',
                'buttons'=>array(
                    'update'=>array(
						'url'=>'Yii::app()->createUrl("admin/user/detail", Yii::app()->params->usePopup ? array("id"=>$data->id, "isPopup"=>"t") : array("id"=>$data->id))',
                        'options'=>array('class'=>'detail')
                    ),
					'delete'=>array(
						'visible'=>'$data->active',
					)
                )
            )
        )
    ));
?>
<?php if (isset($msg) && $msg != '') echo '<ul style="color:blue">'.$msg.'</ul>';?>
<br />
<?php
	if (Yii::app()->params->usePopup)
	{
		$this->widget('application.extensions.fancybox.EFancyBox', array(
			'target'=>'.detail',
			'config'=>array(),
		));
	}

	echo CHtml::link(' Add ', Yii::app()->createUrl('/admin/user/detail', Yii::app()->params->usePopup ? array("isPopup"=>"t") : array()), array('class'=>'link-button detail'));
?>
